***Table 3 and Figures 1, 4, and 5***
clear
set more off
use "module2010_plus_estimates.dta"
keep source respondent x w1 w2 w3
save "module2010_estimates.dta", replace
clear
set more off
set seed 60637
use "bigsurveys_recoded4.dta"
keep if source == "CCES_2012" | source == "CCES_2013" | source == "CCES_2014" | source == "CCES_2015" ///
| source == "CCES_2016" | source == "CCES_2017" | source == "CCES_2018"
append using "module2010_estimates.dta" 
replace weight = "1" if weight == "NA" | weight == ""
destring weight, replace
replace w3 = 0 if w3 < 0
egen sourceid = group(source)
sum sourceid
local nsources = r(max)
forvalues i = 1/`nsources' {
sum x if sourceid == `i'
replace x = (x - r(mean))/r(sd) if sourceid == `i'
}
g conversian = w2 > w1 & w2 > w3
g inattentive = w3 > w1 & w3 > w2
g downsian = w1 > w2 & w1 > w3
sort sourceid downsian x
g rank = weight if downsian == 1 & downsian[_n-1] == 0
replace rank = rank[_n-1] + weight if downsian == 1 & rank == .
g downsianweight = weight if downsian == 1
egen ndownsians = sum(downsianweight), by(sourceid)
replace rank = rank/ndownsians
egen ideogroup = group(sourceid downsian x)
egen maxrank = max(rank), by(ideogroup)
g liberal = downsian == 1 & maxrank <= 1/3
g moderate = downsian == 1 & liberal == 0 & maxrank <= 2/3
g conservative = downsian == 1 & liberal == 0 & moderate == 0
drop rank ndownsians ideogroup maxrank downsianweight
egen meanweight = mean(weight), by(sourceid)
replace weight = weight/meanweight
g weight2 = weight*w1
egen meanweight2 = mean(weight2), by(sourceid)
replace weight2 = weight2/meanweight2
g values = round(x*100)/100
replace values = . if abs(values) > 3
sort values
g unique = values != values[_n-1]
replace values = . if unique != 1
drop unique
g values2 = (_n-1)/1000
replace values2 = . if values2 > 1

*Table 3
g count = 1
split source, p(_)
destring source2, replace
table source2 [aw = weight], statistic(sum count)
table source2 [aw = weight], statistic(mean w1 w2 w3)
drop source1 source2

*Figures 1, 4, and 5
forvalues i = 1/8 {
kdensity x [aw = weight] if sourceid == `i', gen(k_`i'_1) at(values) nograph bw(.1)
kdensity x [aw = weight2] if sourceid == `i', gen(k_`i'_2) at(values) nograph bw(.1)
sort values
graph twoway line k_`i'_1 k_`i'_2 values
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Density
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .xaxis1.reset_rule -3 3 1 , tickset(major) ruletype(range) 
gr_edit .yaxis1.reset_rule 0 1 .2 , tickset(major) ruletype(range) 
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(gs10) width(thick)) editcopy
graph save "Hist`i'.gph", replace
lpoly w1 x if sourceid == `i', gen(lpoly1_`i') at(values) nograph bw(.1)
lpoly w2 x if sourceid == `i', gen(lpoly2_`i') at(values) nograph bw(.1)
lpoly w3 x if sourceid == `i', gen(lpoly3_`i') at(values) nograph bw(.1)
sort values
graph twoway line lpoly*_`i' values
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .xaxis1.reset_rule -3 3 1 , tickset(major) ruletype(range) 
gr_edit .yaxis1.reset_rule 0 1 .2 , tickset(major) ruletype(range) 
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
graph save "Lpoly`i'.gph", replace
kdensity w1 [aw = weight] if sourceid == `i', gen(k_`i'_w1) at(values2) nograph bw(.03)
kdensity w2 [aw = weight] if sourceid == `i', gen(k_`i'_w2) at(values2) nograph bw(.03)
kdensity w3 [aw = weight] if sourceid == `i', gen(k_`i'_w3) at(values2) nograph bw(.03)
sort values2
graph twoway line k_`i'_w1 k_`i'_w2 k_`i'_w3 values2
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Density
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Probability
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .xaxis1.reset_rule 0 1 .2, tickset(major) ruletype(range) 
gr_edit .yaxis1.reset_rule 0 10 2 , tickset(major) ruletype(range) 
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
graph save "Probabilities`i'.gph", replace
}
graph combine "Hist1.gph" "Hist2.gph" "Hist3.gph" "Hist4.gph" "Hist5.gph" "Hist6.gph" "Hist7.gph" "Hist8.gph", col(3)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
forvalues i = 1/5 {
gr_edit .plotregion1.graph`i'.xaxis1.title.draw_view.setstyle, style(no)
}
gr_edit .plotregion1.graph2.yaxis1.title.draw_view.setstyle, style(no)
gr_edit .plotregion1.graph3.yaxis1.title.draw_view.setstyle, style(no)
gr_edit .plotregion1.graph5.yaxis1.title.draw_view.setstyle, style(no)
gr_edit .plotregion1.graph6.yaxis1.title.draw_view.setstyle, style(no)
gr_edit .plotregion1.graph8.yaxis1.title.draw_view.setstyle, style(no)
gr_edit .plotregion1.graph1.title.text = {}
gr_edit .plotregion1.graph1.title.text.Arrpush 2010
gr_edit .plotregion1.graph2.title.text = {}
gr_edit .plotregion1.graph2.title.text.Arrpush 2012
gr_edit .plotregion1.graph3.title.text = {}
gr_edit .plotregion1.graph3.title.text.Arrpush 2013
gr_edit .plotregion1.graph4.title.text = {}
gr_edit .plotregion1.graph4.title.text.Arrpush 2014
gr_edit .plotregion1.graph5.title.text = {}
gr_edit .plotregion1.graph5.title.text.Arrpush 2015
gr_edit .plotregion1.graph6.title.text = {}
gr_edit .plotregion1.graph6.title.text.Arrpush 2016
gr_edit .plotregion1.graph7.title.text = {}
gr_edit .plotregion1.graph7.title.text.Arrpush 2017
gr_edit .plotregion1.graph8.title.text = {}
gr_edit .plotregion1.graph8.title.text.Arrpush 2018
forvalues i = 1/8 {
gr_edit .plotregion1.graph`i'.title.style.editstyle size(medlarge) color(black) editcopy
}
graph export "Figure4.png", replace as(png)
graph export "Figure4.tif", replace as(tif)
graph export "Figure4.eps", replace as(eps)
graph combine "Lpoly1.gph" "Lpoly2.gph" "Lpoly3.gph" "Lpoly4.gph" "Lpoly5.gph" "Lpoly6.gph" "Lpoly7.gph" "Lpoly8.gph", col(3)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
forvalues i = 1/5 {
gr_edit .plotregion1.graph`i'.xaxis1.title.draw_view.setstyle, style(no)
}
gr_edit .plotregion1.graph1.title.text = {}
gr_edit .plotregion1.graph1.title.text.Arrpush 2010
gr_edit .plotregion1.graph2.title.text = {}
gr_edit .plotregion1.graph2.title.text.Arrpush 2012
gr_edit .plotregion1.graph3.title.text = {}
gr_edit .plotregion1.graph3.title.text.Arrpush 2013
gr_edit .plotregion1.graph4.title.text = {}
gr_edit .plotregion1.graph4.title.text.Arrpush 2014
gr_edit .plotregion1.graph5.title.text = {}
gr_edit .plotregion1.graph5.title.text.Arrpush 2015
gr_edit .plotregion1.graph6.title.text = {}
gr_edit .plotregion1.graph6.title.text.Arrpush 2016
gr_edit .plotregion1.graph7.title.text = {}
gr_edit .plotregion1.graph7.title.text.Arrpush 2017
gr_edit .plotregion1.graph8.title.text = {}
gr_edit .plotregion1.graph8.title.text.Arrpush 2018
forvalues i = 1/8 {
gr_edit .plotregion1.graph`i'.title.style.editstyle size(medlarge) color(black) editcopy
}
graph export "Figure5.png", replace as(png)
graph export "Figure5.tif", replace as(tif)
graph export "Figure5.eps", replace as(eps)
graph combine "Probabilities1.gph" "Probabilities2.gph" "Probabilities3.gph" "Probabilities4.gph" "Probabilities5.gph" "Probabilities6.gph" "Probabilities7.gph" "Probabilities8.gph", col(3)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
forvalues i = 1/5 {
gr_edit .plotregion1.graph`i'.xaxis1.title.draw_view.setstyle, style(no)
}
gr_edit .plotregion1.graph2.yaxis1.title.draw_view.setstyle, style(no)
gr_edit .plotregion1.graph3.yaxis1.title.draw_view.setstyle, style(no)
gr_edit .plotregion1.graph5.yaxis1.title.draw_view.setstyle, style(no)
gr_edit .plotregion1.graph6.yaxis1.title.draw_view.setstyle, style(no)
gr_edit .plotregion1.graph8.yaxis1.title.draw_view.setstyle, style(no)
gr_edit .plotregion1.graph1.title.text = {}
gr_edit .plotregion1.graph1.title.text.Arrpush 2010
gr_edit .plotregion1.graph2.title.text = {}
gr_edit .plotregion1.graph2.title.text.Arrpush 2012
gr_edit .plotregion1.graph3.title.text = {}
gr_edit .plotregion1.graph3.title.text.Arrpush 2013
gr_edit .plotregion1.graph4.title.text = {}
gr_edit .plotregion1.graph4.title.text.Arrpush 2014
gr_edit .plotregion1.graph5.title.text = {}
gr_edit .plotregion1.graph5.title.text.Arrpush 2015
gr_edit .plotregion1.graph6.title.text = {}
gr_edit .plotregion1.graph6.title.text.Arrpush 2016
gr_edit .plotregion1.graph7.title.text = {}
gr_edit .plotregion1.graph7.title.text.Arrpush 2017
gr_edit .plotregion1.graph8.title.text = {}
gr_edit .plotregion1.graph8.title.text.Arrpush 2018
forvalues i = 1/8 {
gr_edit .plotregion1.graph`i'.title.style.editstyle size(medlarge) color(black) editcopy
}
graph export "Figure1.png", replace as(png)
graph export "Figure1.tif", replace as(tif)
graph export "Figure1.eps", replace as(eps)
forvalues i = 1/8 {
erase "Lpoly`i'.gph"
erase "Hist`i'.gph"
erase "Probabilities`i'.gph"
}


***Figure 2***
clear
set more off
use "module2010_plus_estimates.dta"
rename redist_eliminateminwage eliminateminwage
rename npat_employment4 dontraiseminwage
rename redist_15dollarminwage dontraiseminwageto15
g mw_15plus = dontraiseminwageto15 == 0 & eliminateminwage == 0
g mw_0 = dontraiseminwageto15 == 1 & eliminateminwage == 1
g mw_inbetween = dontraiseminwageto15 == 1 & eliminateminwage == 0
g mw_confused = dontraiseminwageto15 == 0 & eliminateminwage == 1
drop if dontraiseminwageto15 == .
drop if eliminateminwage == .
g downsian = w1 > w2 & w1 > w3
g conversian = w2 > w1 & w2 > w3
g inattentive = w3 > w1 & w3 > w2
g category = 1 
replace category = 2 if conversian == 1
replace category = 3 if inattentive == 1
g values = (_n-1)/(_N-1)
replace values = values*5 - 2.5
sum x if downsian == 1, d
g values1 = values if values >= r(p5) & values <= r(p95)
sum x if conversian == 1, d
g values2 = values if values >= r(p5) & values <= r(p95)
sum x if inattentive == 1, d
g values3 = values if values >= r(p5) & values <= r(p95)
foreach j in 0 15plus inbetween confused {
forvalues i = 1/3 {
lpoly mw_`j' x if category == `i', bw(.3) nograph gen(k_`i') at(values`i')
}
sort values1
graph twoway line k_* values1
gr_edit .yaxis1.title.text = {}
*gr_edit .yaxis1.title.text.Arrpush Raise Minimum Wage to $15/hr
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
*gr_edit .yaxis1.reset_rule .5 .9 .2 , tickset(major) ruletype(range) 
graph save "Kernel_MW`j'.gph", replace
drop k_*
}
graph combine "Kernel_MW0.gph" "Kernel_MW15plus.gph" "Kernel_MWinbetween.gph" "Kernel_MWconfused.gph" , col(2)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
*gr_edit .style.editstyle declared_ysize(6) editcopy
forvalues i = 1/2 {
gr_edit .plotregion1.graph`i'.xaxis1.title.draw_view.setstyle, style(no)
}
gr_edit .plotregion1.graph1.yaxis1.title.text = {}
gr_edit .plotregion1.graph1.yaxis1.title.text.Arrpush Eliminate Minimum Wage
gr_edit .plotregion1.graph2.yaxis1.title.text = {}
gr_edit .plotregion1.graph2.yaxis1.title.text.Arrpush Raise Minimum Wage to $15/hr
gr_edit .plotregion1.graph3.yaxis1.title.text = {}
gr_edit .plotregion1.graph3.yaxis1.title.text.Arrpush Neither
gr_edit .plotregion1.graph4.yaxis1.title.text = {}
gr_edit .plotregion1.graph4.yaxis1.title.text.Arrpush Both
graph export "Figure2.png", replace as(png)
graph export "Figure2.tif", replace as(tif)
graph export "Figure2.eps", replace as(eps)


***Figure 3***
clear
set more off
set seed 60637
use "bigsurveys_recoded4.dta" 
replace weight = "1" if weight == "NA"
destring weight, replace
keep if source == "CCES_2014"
sum x
replace x = (x - r(mean))/r(sd)
keep respondent x w1 w2 w3 weight
sort respondent
save "Estimates2014.dta", replace
clear
set more off
use "CCES_2014_modules_extreme_responses.dta"
sort respondent
merge respondent using "Estimates2014.dta"
tab _merge
keep if _merge == 3
drop _merge
g prop_xc = extreme_conserv_responses/extreme_conserv_items
g prop_xl = extreme_lib_responses/extreme_lib_items
g prop_xavg = (prop_xc + prop_xl)/2
g conversian = w2 > w1 & w2 > w3
g inattentive = w3 > w1 & w3 > w2
g downsian = w1 > w2 & w1 > w3
g values = (_n-1)/(_N-1)
replace values = values*4 - 2
sum x if downsian == 1, d
g values1 = values if values >= r(p5) & values <= r(p95)
sum x if conversian == 1, d
g values2 = values if values >= r(p5) & values <= r(p95)
sum x if inattentive == 1, d
g values3 = values if values >= r(p5) & values <= r(p95)
g category = 1 
replace category = 2 if conversian == 1
replace category = 3 if inattentive == 1
forvalues i = 1/3 {
lpoly prop_xc x if category == `i' [aw = weight], bw(.1) nograph gen(k_cons_`i') at(values`i')
}
graph twoway line k_cons_* values
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Extreme Conservative Responses
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule 0 .8 .2 , tickset(major) ruletype(range) 
graph save "ExtremeConservative.gph", replace
forvalues i = 1/3 {
lpoly prop_xl x if category == `i' [aw = weight], bw(.1) nograph gen(k_lib_`i') at(values`i')
}
graph twoway line k_lib_* values
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Extreme Liberal Responses
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule 0 .8 .2 , tickset(major) ruletype(range) 
graph save "ExtremeLiberal.gph", replace
forvalues i = 1/3 {
lpoly prop_xavg x if category == `i' [aw = weight], bw(.1) nograph gen(k_avg_`i') at(values`i')
}
graph twoway line k_avg_* values
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Extreme Responses
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule .1 .5 .1 , tickset(major) ruletype(range) 
graph save "ExtremeAvg.gph", replace
graph combine "ExtremeLiberal.gph" "ExtremeConservative.gph"  "ExtremeAvg.gph", col(3)
gr_edit .style.editstyle declared_ysize(2) margin(zero) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
forvalues i = 1/3 {
gr_edit .plotregion1.graph`i'.xaxis1.title.style.editstyle size(large) editcopy
gr_edit .plotregion1.graph`i'.yaxis1.title.style.editstyle size(large) editcopy
gr_edit .plotregion1.graph`i'.xaxis1.style.editstyle majorstyle(tickstyle(textstyle(size(large))) use_labels(no) alternate(no)) editcopy
gr_edit .plotregion1.graph`i'.yaxis1.style.editstyle majorstyle(tickstyle(textstyle(size(large))) use_labels(no) alternate(no)) editcopy
forvalues j = 1/3 {
gr_edit .plotregion1.graph`i'.plotregion1.plot`j'.style.editstyle line(width(vthick)) editcopy
}
}
graph export "Figure3.png", replace as(png)
graph export "Figure3.tif", replace as(tif)
graph export "Figure3.eps", replace as(eps)


***Figures 6 and A6***
clear
use "bigsurveys_recoded4.dta"
keep if source == "CCES_2016"
keep respondent x w1 w2 w3
sort respondent
save "Estimates_CCES2016.dta", replace
clear
set more off
use "CCES16_Common_OUTPUT_Feb2018_VV.dta"
rename V101 respondent
sort respondent
merge respondent using "Estimates_CCES2016.dta"
tab _merge
drop _merge
rename inputstate state
rename countyfips county
g registered = votereg_f == 1
g registered_validated = CL_voterstatus == "active" | CL_voterstatus == "inactiv" | CL_voterstatus == "multipl" 
g age = 2016 - birthyr
g female = gender == 2
g white = race == 1
g whitefemale = female == 1 & white == 1
g black = race == 2
drop hispanic
g hispanic = race == 3
g asian = race == 4
g trump16 = .5
replace trump16 = 0 if CC16_410a == 2
replace trump16 = 1 if CC16_410a == 1
g romney12 = .5
replace romney12 = 0 if CC16_326 == 1
replace romney12 = 1 if CC16_326 == 2
g obamatotrump = romney12 == 0 & trump16 == 1
g romneytoclinton = romney12 == 1 & trump16 == 0
g college = educ == 5 | educ == 6
g inc100 = faminc >= 10 & faminc <= 31
g church = pew_churatd <= 3
g young = age < 30
g old = age >= 70
g democrat = pid3 == 1
g republican = pid3 == 2
g independent = pid3 == 3
g liberal = ideo5 == 1 | ideo5 == 2
g moderate = ideo5 == 3
g conservative = ideo5 == 4 | ideo5 == 5
g turnout16 = CC16_401 == 5
g turnout16_validated = CL_E2016GVM != ""
g readnewspaper = CC16_300_3 == 1
g polinterest = newsint
replace polinterest = 4 if polinterest == 7 | polinterest == .
replace polinterest = (4 - polinterest)/3
g knowledge_house = CC16_321a == 1
g knowledge_senate = CC16_321b == 1
g knowledge = knowledge_house*knowledge_senate
g donate = CC16_417a_4 == 1
g contacted = CC16_425a == 1
sum x
replace x = (x - r(mean))/r(sd)
forvalues i = 2/4 {
g x`i' = x^`i'
}
g w1_category = 1
replace w1_category = 2 if w1 >= .5 & w1 < .8
replace w1_category = 3 if w1 >= .8
g downsian = w1 > w2 & w1 > w3
g conversian = w2 > w1 & w2 > w3
g inattentive = w3 > w1 & w3 > w2
g category = 1 
replace category = 2 if conversian == 1
replace category = 3 if inattentive == 1
g values = (_n-1)/(_N-1)
replace values = values*5 - 2.5
sum x if downsian == 1, d
g values1 = values if values >= r(p5) & values <= r(p95)
sum x if conversian == 1, d
g values2 = values if values >= r(p5) & values <= r(p95)
sum x if inattentive == 1, d
g values3 = values if values >= r(p5) & values <= r(p95)
g switch2016 = romneytoclinton == 1 | obamatotrump == 1
tab downsian if switch2016 == 1 [aw = commonweight]
g ideology = ideo5
replace ideology = 3 if ideo5 > 5
replace ideology = (ideology - 1)/4
tab ideology
g ideology_w1 = ideology*w1
g partyid = pid7
replace partyid = 4 if pid7 > 7
replace partyid = (partyid - 1)/6

*Figure 6
forvalues i = 1/3 {
lpoly polinterest x if category == `i' [aw = commonweight] , bw(.1) nograph gen(k_polint_`i') at(values`i')
}
sort values1
graph twoway line k_polint_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Political Interest
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule .5 .9 .2 , tickset(major) ruletype(range) 
graph save "Kernel_PolInt.gph", replace
forvalues i = 1/3 {
lpoly turnout16_validated x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_turnout_`i') at(values`i')
}
sort values1
graph twoway line k_turnout_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Turnout 2016
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule .2 .8 .3 , tickset(major) ruletype(range) 
graph save "Kernel_Turnout.gph", replace
forvalues i = 1/3 {
lpoly registered_validated x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_registered_`i') at(values`i')
}
sort values1
graph twoway line k_registered_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Registered to Vote
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule .2 .8 .3 , tickset(major) ruletype(range) 
graph save "Kernel_Registration.gph", replace
forvalues i = 1/3 {
lpoly readnewspaper x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_newspaper_`i') at(values`i')
}
sort values1
graph twoway line k_newspaper_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Read Newspaper
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule .3 .7 .2 , tickset(major) ruletype(range) 
graph save "Kernel_Newspaper.gph", replace
forvalues i = 1/3 {
lpoly knowledge x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_knowledge_`i') at(values`i')
}
sort values1
graph twoway line k_knowledge_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Political Knowledge
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule .2 1 .4 , tickset(major) ruletype(range) 
graph save "Kernel_Knowledge.gph", replace
forvalues i = 1/3 {
lpoly donate x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_donate_`i') at(values`i')
}
sort values1
graph twoway line k_donate_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Political Donation
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule .1 .5 .2 , tickset(major) ruletype(range) 
graph save "Kernel_Donate.gph", replace
forvalues i = 1/3 {
lpoly contacted x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_contacted_`i') at(values`i')
}
sort values1
graph twoway line k_contacted_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Reports Being Contacted
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule .2 .6 .2 , tickset(major) ruletype(range) 
graph save "Kernel_Contacted.gph", replace
forvalues i = 1/3 {
lpoly obamatotrump x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_obamatotrump_`i') at(values`i')
}
sort values1
graph twoway line k_obamatotrump_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Obama to Trump
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule 0 .06 .03 , tickset(major) ruletype(range) 
graph save "Kernel_ObamaToTrump.gph", replace
forvalues i = 1/3 {
lpoly romneytoclinton x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_romneytoclinton_`i') at(values`i')
}
sort values1
graph twoway line k_romneytoclinton_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Romney to Clinton
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule 0 .02 .01 , tickset(major) ruletype(range) 
graph save "Kernel_RomneyToClinton.gph", replace
forvalues i = 1/3 {
lpoly democrat x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_democrat_`i') at(values`i')
}
sort values1
graph twoway line k_democrat_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Democrat
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule 0 .8 .4 , tickset(major) ruletype(range) 
graph save "Kernel_Democrat.gph", replace
forvalues i = 1/3 {
lpoly republican x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_republican_`i') at(values`i')
}
sort values1
graph twoway line k_republican_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Republican
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule 0 .6 .3 , tickset(major) ruletype(range) 
graph save "Kernel_Republican.gph", replace
forvalues i = 1/3 {
lpoly independent x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_independent_`i') at(values`i')
}
sort values1
graph twoway line k_independent_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Independent
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule .2 .4 .1 , tickset(major) ruletype(range) 
graph save "Kernel_Independent.gph", replace
forvalues i = 1/3 {
lpoly liberal x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_liberal_`i') at(values`i')
}
sort values1
graph twoway line k_liberal_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Liberal
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule 0 .8 .4 , tickset(major) ruletype(range) 
graph save "Kernel_Liberal.gph", replace
forvalues i = 1/3 {
lpoly conservative x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_conservative_`i') at(values`i')
}
sort values1
graph twoway line k_conservative_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Conservative
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule 0 1 .5 , tickset(major) ruletype(range) 
graph save "Kernel_Conservative.gph", replace
forvalues i = 1/3 {
lpoly moderate x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_moderate_`i') at(values`i')
}
sort values1
graph twoway line k_moderate_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Moderate
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
gr_edit .yaxis1.reset_rule .1 .5 .2 , tickset(major) ruletype(range) 
graph save "Kernel_Moderate.gph", replace
graph combine "Kernel_PolInt.gph" "Kernel_Knowledge.gph" "Kernel_Newspaper.gph" "Kernel_Registration.gph" ///
"Kernel_Turnout.gph" "Kernel_Donate.gph" "Kernel_Contacted.gph" "Kernel_ObamaToTrump.gph" "Kernel_RomneyToClinton.gph" ///
"Kernel_Democrat.gph" "Kernel_Republican.gph" "Kernel_Independent.gph" "Kernel_Liberal.gph" "Kernel_Conservative.gph" "Kernel_Moderate.gph", col(3)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .style.editstyle declared_ysize(6) editcopy
forvalues i = 1/12 {
gr_edit .plotregion1.graph`i'.xaxis1.title.draw_view.setstyle, style(no)
}
graph export "Figure6.png", replace as(png)
graph export "Figure6.tif", replace as(tif)
graph export "Figure6.eps", replace as(eps)

*Figure A6
forvalues i = 1/3 {
lpoly white x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_white_`i') at(values`i')
}
sort values1
graph twoway line k_white_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush White
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
graph save "Kernel_White.gph", replace
forvalues i = 1/3 {
lpoly black x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_black_`i') at(values`i')
}
sort values1
graph twoway line k_black_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Black
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
graph save "Kernel_Black.gph", replace
forvalues i = 1/3 {
lpoly hispanic x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_hispanic_`i') at(values`i')
}
sort values1
graph twoway line k_hispanic_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Hispanic
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
graph save "Kernel_Hispanic.gph", replace
forvalues i = 1/3 {
lpoly asian x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_asian_`i') at(values`i')
}
sort values1
graph twoway line k_asian_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Asian
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
graph save "Kernel_Asian.gph", replace
forvalues i = 1/3 {
lpoly female x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_female_`i') at(values`i')
}
sort values1
graph twoway line k_female_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Female
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
graph save "Kernel_Female.gph", replace
forvalues i = 1/3 {
lpoly college x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_college_`i') at(values`i')
}
sort values1
graph twoway line k_college_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush College
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
graph save "Kernel_College.gph", replace
forvalues i = 1/3 {
lpoly inc100 x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_inc100_`i') at(values`i')
}
sort values1
graph twoway line k_inc100_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Income > 100k
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
graph save "Kernel_Inc100.gph", replace
forvalues i = 1/3 {
lpoly church x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_church_`i') at(values`i')
}
sort values1
graph twoway line k_church_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Church
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
graph save "Kernel_Church.gph", replace
forvalues i = 1/3 {
lpoly young x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_young_`i') at(values`i')
}
sort values1
graph twoway line k_young_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Age < 30
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
graph save "Kernel_Young.gph", replace
forvalues i = 1/3 {
lpoly old x if category == `i' [aw = commonweight], bw(.1) nograph gen(k_old_`i') at(values`i')
}
sort values1
graph twoway line k_old_* values1
gr_edit .yaxis1.title.text = {}
gr_edit .yaxis1.title.text.Arrpush Age > 69
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Estimated Ideology
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(black) width(thick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(gs8) width(thick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs13) width(thick)) editcopy
graph save "Kernel_Old.gph", replace
graph combine "Kernel_White.gph" "Kernel_Black.gph" "Kernel_Hispanic.gph"  ///
"Kernel_Female.gph" "Kernel_Young.gph" "Kernel_Old.gph" "Kernel_College.gph" ///
"Kernel_Inc100.gph" "Kernel_Church.gph", col(3)
gr_edit .style.editstyle margin(vsmall) boxstyle(shadestyle(color(white)) linestyle(color(white))) editcopy
forvalues i = 1/6 {
gr_edit .plotregion1.graph`i'.xaxis1.title.draw_view.setstyle, style(no)
}
graph export "FigureA6.png", replace as(png)
graph export "FigureA6.tif", replace as(tif)
graph export "FigureA6.eps", replace as(eps)


***Tables 4 and A6-A9***
clear
set more off
postutil clear
use "CCES_Contextual_Cleaned.dta"
sum midpoint, d
replace midpoint = (midpoint - r(p5))/(r(p95) - r(p5))
g conversian = w2 > w1 & w2 > w3
g inattentive = w3 > w1 & w3 > w2
g downsian = w1 > w2 & w1 > w3
sort year downsian x
g rank = weight if downsian == 1 & downsian[_n-1] == 0
replace rank = rank[_n-1] + weight if downsian == 1 & rank == .
g downsianweight = weight if downsian == 1
egen ndownsians = sum(downsianweight), by(year)
replace rank = rank/ndownsians
egen ideogroup = group(year downsian x)
egen maxrank = max(rank), by(ideogroup)
g liberal = downsian == 1 & maxrank <= 1/3
g moderate = downsian == 1 & liberal == 0 & maxrank <= 2/3
g conservative = downsian == 1 & liberal == 0 & moderate == 0
drop rank ndownsians ideogroup maxrank downsianweight
sum conversian-conservative [aw = weight]
foreach i in moderate conservative conversian inattentive {
g midpoint_`i' = midpoint*`i'
g incumbency_`i' = incumbency*`i'
g experience_`i' = experience*`i'
}
egen raceid = group(housedist year)
egen distid = group(housedist)
g houseabstain = housevote == .5
g dem = pid7 >= 1 & pid7 <= 2
g rep = pid7 >= 6 & pid7 <= 7
g ind = dem + rep == 0
foreach i in liberal moderate conservative conversian inattentive {
foreach j in dem ind rep {
g `i'_`j' = `i' == 1 & `j' == 1
foreach k in midpoint incumbency experience {
g `i'_`j'_`k' = `i'_`j'*`k'
}
}
}
*Table 4
areg housevote moderate conservative conversian inattentive midpoint* [aw = weight], a(year) cluster(distid)
outreg2 using TableContextual, replace noaster dec(3)
reghdfe housevote moderate conservative conversian inattentive midpoint* [aw = weight], a(distid year) cluster(distid)
outreg2 using TableContextual, append noaster dec(3)
areg housevote moderate conservative conversian inattentive midpoint* [aw = weight], a(raceid) cluster(distid)
outreg2 using TableContextual, append noaster dec(3)
areg housevote moderate conservative conversian inattentive incumbency* [aw = weight], a(year) cluster(distid)
outreg2 using TableContextual, append noaster dec(3)
reghdfe housevote moderate conservative conversian inattentive incumbency* [aw = weight], a(distid year) cluster(distid)
outreg2 using TableContextual, append noaster dec(3)
areg housevote moderate conservative conversian inattentive incumbency* [aw = weight], a(raceid) cluster(distid)
outreg2 using TableContextual, append noaster dec(3)
areg housevote moderate conservative conversian inattentive experience* [aw = weight], a(year) cluster(distid)
outreg2 using TableContextual, append noaster dec(3)
reghdfe housevote moderate conservative conversian inattentive experience* [aw = weight], a(distid year) cluster(distid)
outreg2 using TableContextual, append noaster dec(3)
areg housevote moderate conservative conversian inattentive experience* [aw = weight], a(raceid) cluster(distid)
outreg2 using TableContextual, append noaster dec(3)

*Table A6
areg housevote moderate conservative conversian inattentive midpoint* [aw = weight] if housevote == 0 | housevote == 1, a(year) cluster(distid)
outreg2 using TableContextual_noabstainers, replace noaster dec(3)
reghdfe housevote moderate conservative conversian inattentive midpoint* [aw = weight] if housevote == 0 | housevote == 1, a(distid year) cluster(distid)
outreg2 using TableContextual_noabstainers, append noaster dec(3)
areg housevote moderate conservative conversian inattentive midpoint* [aw = weight] if housevote == 0 | housevote == 1, a(raceid) cluster(distid)
outreg2 using TableContextual_noabstainers, append noaster dec(3)
areg housevote moderate conservative conversian inattentive incumbency* [aw = weight] if housevote == 0 | housevote == 1, a(year) cluster(distid)
outreg2 using TableContextual_noabstainers, append noaster dec(3)
reghdfe housevote moderate conservative conversian inattentive incumbency* [aw = weight] if housevote == 0 | housevote == 1, a(distid year) cluster(distid)
outreg2 using TableContextual_noabstainers, append noaster dec(3)
areg housevote moderate conservative conversian inattentive incumbency* [aw = weight] if housevote == 0 | housevote == 1, a(raceid) cluster(distid)
outreg2 using TableContextual_noabstainers, append noaster dec(3)
areg housevote moderate conservative conversian inattentive experience* [aw = weight] if housevote == 0 | housevote == 1, a(year) cluster(distid)
outreg2 using TableContextual_noabstainers, append noaster dec(3)
reghdfe housevote moderate conservative conversian inattentive experience* [aw = weight] if housevote == 0 | housevote == 1, a(distid year) cluster(distid)
outreg2 using TableContextual_noabstainers, append noaster dec(3)
areg housevote moderate conservative conversian inattentive experience* [aw = weight] if housevote == 0 | housevote == 1, a(raceid) cluster(distid)
outreg2 using TableContextual_noabstainers, append noaster dec(3)

*Table A7
areg houseabstain moderate conservative conversian inattentive midpoint* [aw = weight], a(year) cluster(distid)
outreg2 using TableContextual_abstention, replace noaster dec(3)
reghdfe houseabstain moderate conservative conversian inattentive midpoint* [aw = weight], a(distid year) cluster(distid)
outreg2 using TableContextual_abstention, append noaster dec(3)
areg houseabstain moderate conservative conversian inattentive midpoint* [aw = weight], a(raceid) cluster(distid)
outreg2 using TableContextual_abstention, append noaster dec(3)
areg houseabstain moderate conservative conversian inattentive incumbency* [aw = weight], a(year) cluster(distid)
outreg2 using TableContextual_abstention, append noaster dec(3)
reghdfe houseabstain moderate conservative conversian inattentive incumbency* [aw = weight], a(distid year) cluster(distid)
outreg2 using TableContextual_abstention, append noaster dec(3)
areg houseabstain moderate conservative conversian inattentive incumbency* [aw = weight], a(raceid) cluster(distid)
outreg2 using TableContextual_abstention, append noaster dec(3)
areg houseabstain moderate conservative conversian inattentive experience* [aw = weight], a(year) cluster(distid)
outreg2 using TableContextual_abstention, append noaster dec(3)
reghdfe houseabstain moderate conservative conversian inattentive experience* [aw = weight], a(distid year) cluster(distid)
outreg2 using TableContextual_abstention, append noaster dec(3)
areg houseabstain moderate conservative conversian inattentive experience* [aw = weight], a(raceid) cluster(distid)
outreg2 using TableContextual_abstention, append noaster dec(3)

*Table A8
xi:areg housevote moderate conservative conversian inattentive midpoint* i.pid7 [aw = weight], a(year) cluster(distid)
outreg2 using TableContextual_controllingforparty, replace noaster dec(3)
xi:reghdfe housevote moderate conservative conversian inattentive midpoint* i.pid7 [aw = weight], a(distid year) cluster(distid)
outreg2 using TableContextual_controllingforparty, append noaster dec(3)
xi:areg housevote moderate conservative conversian inattentive midpoint* i.pid7 [aw = weight], a(raceid) cluster(distid)
outreg2 using TableContextual_controllingforparty, append noaster dec(3)
xi:areg housevote moderate conservative conversian inattentive incumbency* i.pid7 [aw = weight], a(year) cluster(distid)
outreg2 using TableContextual_controllingforparty, append noaster dec(3)
xi:reghdfe housevote moderate conservative conversian inattentive incumbency* i.pid7 [aw = weight], a(distid year) cluster(distid)
outreg2 using TableContextual_controllingforparty, append noaster dec(3)
xi:areg housevote moderate conservative conversian inattentive incumbency* i.pid7 [aw = weight], a(raceid) cluster(distid)
outreg2 using TableContextual_controllingforparty, append noaster dec(3)
xi:areg housevote moderate conservative conversian inattentive experience* i.pid7 [aw = weight], a(year) cluster(distid)
outreg2 using TableContextual_controllingforparty, append noaster dec(3)
xi:reghdfe housevote moderate conservative conversian inattentive experience* i.pid7 [aw = weight], a(distid year) cluster(distid)
outreg2 using TableContextual_controllingforparty, append noaster dec(3)
xi:areg housevote moderate conservative conversian inattentive experience* i.pid7 [aw = weight], a(raceid) cluster(distid)
outreg2 using TableContextual_controllingforparty, append noaster dec(3)

*Table A9
areg housevote liberal_ind_midpoint liberal_rep_midpoint moderate_dem_midpoint moderate_ind_midpoint moderate_rep_midpoint conservative_dem_midpoint conservative_ind_midpoint conservative_rep_midpoint conversian_dem_midpoint conversian_ind_midpoint conversian_rep_midpoint inattentive_dem_midpoint inattentive_ind_midpoint inattentive_rep_midpoint midpoint liberal_ind liberal_rep moderate_dem moderate_ind moderate_rep conservative_dem conservative_ind conservative_rep conversian_dem conversian_ind conversian_rep inattentive_dem inattentive_ind inattentive_rep [aw = weight], a(year) cluster(distid)
outreg2 using TableContextual_partybytype, replace noaster dec(3)
reghdfe housevote liberal_ind_midpoint liberal_rep_midpoint moderate_dem_midpoint moderate_ind_midpoint moderate_rep_midpoint conservative_dem_midpoint conservative_ind_midpoint conservative_rep_midpoint conversian_dem_midpoint conversian_ind_midpoint conversian_rep_midpoint inattentive_dem_midpoint inattentive_ind_midpoint inattentive_rep_midpoint midpoint liberal_ind liberal_rep moderate_dem moderate_ind moderate_rep conservative_dem conservative_ind conservative_rep conversian_dem conversian_ind conversian_rep inattentive_dem inattentive_ind inattentive_rep [aw = weight], a(distid year) cluster(distid)
outreg2 using TableContextual_partybytype, append noaster dec(3)
areg housevote liberal_ind_midpoint liberal_rep_midpoint moderate_dem_midpoint moderate_ind_midpoint moderate_rep_midpoint conservative_dem_midpoint conservative_ind_midpoint conservative_rep_midpoint conversian_dem_midpoint conversian_ind_midpoint conversian_rep_midpoint inattentive_dem_midpoint inattentive_ind_midpoint inattentive_rep_midpoint midpoint liberal_ind liberal_rep moderate_dem moderate_ind moderate_rep conservative_dem conservative_ind conservative_rep conversian_dem conversian_ind conversian_rep inattentive_dem inattentive_ind inattentive_rep [aw = weight], a(raceid) cluster(distid)
outreg2 using TableContextual_partybytype, append noaster dec(3)
areg housevote liberal_ind_incumbency liberal_rep_incumbency moderate_dem_incumbency moderate_ind_incumbency moderate_rep_incumbency conservative_dem_incumbency conservative_ind_incumbency conservative_rep_incumbency conversian_dem_incumbency conversian_ind_incumbency conversian_rep_incumbency inattentive_dem_incumbency inattentive_ind_incumbency inattentive_rep_incumbency incumbency liberal_ind liberal_rep moderate_dem moderate_ind moderate_rep conservative_dem conservative_ind conservative_rep conversian_dem conversian_ind conversian_rep inattentive_dem inattentive_ind inattentive_rep [aw = weight], a(year) cluster(distid)
outreg2 using TableContextual_partybytype, append noaster dec(3)
reghdfe housevote liberal_ind_incumbency liberal_rep_incumbency moderate_dem_incumbency moderate_ind_incumbency moderate_rep_incumbency conservative_dem_incumbency conservative_ind_incumbency conservative_rep_incumbency conversian_dem_incumbency conversian_ind_incumbency conversian_rep_incumbency inattentive_dem_incumbency inattentive_ind_incumbency inattentive_rep_incumbency incumbency liberal_ind liberal_rep moderate_dem moderate_ind moderate_rep conservative_dem conservative_ind conservative_rep conversian_dem conversian_ind conversian_rep inattentive_dem inattentive_ind inattentive_rep [aw = weight], a(distid year) cluster(distid)
outreg2 using TableContextual_partybytype, append noaster dec(3)
areg housevote liberal_ind_incumbency liberal_rep_incumbency moderate_dem_incumbency moderate_ind_incumbency moderate_rep_incumbency conservative_dem_incumbency conservative_ind_incumbency conservative_rep_incumbency conversian_dem_incumbency conversian_ind_incumbency conversian_rep_incumbency inattentive_dem_incumbency inattentive_ind_incumbency inattentive_rep_incumbency incumbency liberal_ind liberal_rep moderate_dem moderate_ind moderate_rep conservative_dem conservative_ind conservative_rep conversian_dem conversian_ind conversian_rep inattentive_dem inattentive_ind inattentive_rep [aw = weight], a(raceid) cluster(distid)
outreg2 using TableContextual_partybytype, append noaster dec(3)
areg housevote liberal_ind_experience liberal_rep_experience moderate_dem_experience moderate_ind_experience moderate_rep_experience conservative_dem_experience conservative_ind_experience conservative_rep_experience conversian_dem_experience conversian_ind_experience conversian_rep_experience inattentive_dem_experience inattentive_ind_experience inattentive_rep_experience experience liberal_ind liberal_rep moderate_dem moderate_ind moderate_rep conservative_dem conservative_ind conservative_rep conversian_dem conversian_ind conversian_rep inattentive_dem inattentive_ind inattentive_rep [aw = weight], a(year) cluster(distid)
outreg2 using TableContextual_partybytype, append noaster dec(3)
reghdfe housevote liberal_ind_experience liberal_rep_experience moderate_dem_experience moderate_ind_experience moderate_rep_experience conservative_dem_experience conservative_ind_experience conservative_rep_experience conversian_dem_experience conversian_ind_experience conversian_rep_experience inattentive_dem_experience inattentive_ind_experience inattentive_rep_experience experience liberal_ind liberal_rep moderate_dem moderate_ind moderate_rep conservative_dem conservative_ind conservative_rep conversian_dem conversian_ind conversian_rep inattentive_dem inattentive_ind inattentive_rep [aw = weight], a(distid year) cluster(distid)
outreg2 using TableContextual_partybytype, append noaster dec(3)
areg housevote liberal_ind_experience liberal_rep_experience moderate_dem_experience moderate_ind_experience moderate_rep_experience conservative_dem_experience conservative_ind_experience conservative_rep_experience conversian_dem_experience conversian_ind_experience conversian_rep_experience inattentive_dem_experience inattentive_ind_experience inattentive_rep_experience experience liberal_ind liberal_rep moderate_dem moderate_ind moderate_rep conservative_dem conservative_ind conservative_rep conversian_dem conversian_ind conversian_rep inattentive_dem inattentive_ind inattentive_rep [aw = weight], a(raceid) cluster(distid)
outreg2 using TableContextual_partybytype, append noaster dec(3)


